//
//  Mp4Recorder.h
//  TRTC-API-Example-OC
//
//  Created by rykeryin on 2021/8/23.
//

#import <Foundation/Foundation.h>
#import <TXLiteAVSDK_TRTC/TRTCCloud.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, TRTCRemoteRecordEvent)   {
    TRTCRemoteRecordStartSuccess, // 启动录制成功
    TRTCRemoteRecordStopSuccess,  // 停止录制成功
    TRTCRemoteRecordStartFailed, // 启动录制失败
    TRTCRemoteRecordStopFailed,  // 停止录制失败
    TRTCRemoteRecordAudioEncodeError, // 音频编码失败
    TRTCRemoteRecordVideoEncodeError, // 视频编码失败
    TRTCRemoteRecordVideoMuxerError, // 合成Mp4失败
    TRTCRemoteRecordComplete, // 合成成功
};


@protocol TRTCRemoteRecorderDelegate <NSObject>

//// 0 成功，1、AVAssetWriter启动失败 2、AudioInput添加失败 3、VideoInput添加失败 4、重复启动录制
//- (void)onStartRecord:(int)reason;
//// 0 正常录制结束, 1、音频buff添加失败。2、视频buff添加失败
//- (void)onRecordFinish:(int)reason;

- (void)onRemoteRecordEvent:(TRTCRemoteRecordEvent)event detail:(id)detail;

@end


@interface TRTCRecordConfig : NSObject

@property (nonatomic, assign) int videoGop;
@property (nonatomic, assign) int videoFps;
@property (nonatomic, assign) int videoBitrate;
@property (nonatomic, assign) int audioBitrate;
@property (nonatomic, assign) int audioSample;
@property (nonatomic, assign) int audioChannel;
@property (nonatomic, copy) NSString *filePath;
@end


@interface TRTCRemoteRecorder : NSObject

- (void)setConfig:(TRTCRecordConfig *)config;

- (void)setDelegate:(id<TRTCRemoteRecorderDelegate>)delegate;
// 启动录制
- (void)startRecord;
// 停止录制，远端停止视频流需主动停止录制 onUserVideoAvailable:NO
- (void)stopRecord;

- (void)pushVideoFrame:(TRTCVideoFrame *)frame;

- (void)pushAudioFrame:(TRTCAudioFrame *)frame;

@end



NS_ASSUME_NONNULL_END
